﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ECare.BUS.Data;
using ECare.Database;

namespace ECare.BUS
{
    public class PermissionHelper
    {

        public static List<PermissionInfo> GetPermissions()
        {
            using (var context = new Entities())
            {
                var res = new List<PermissionInfo>();

                var permissions = context.modules_permissions.ToList();
                
                foreach (var permission in permissions)
                {
                    var newpermission = new PermissionInfo();
                    newpermission.ModuleId = permission.module_id;
                    newpermission.PermissionId = permission.module_permission_id;
                    newpermission.PermissionName = permission.module_permission_text;
                    res.Add(newpermission);
                }

                return res;
            }
        }
    }
}
